{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}
<div id="mirroring">
  {{#unless controller.isRequiredServicesStarted}}
    <div class="alert alert-error">{{t mirroring.dataset.services.not.started}}</div>
  {{/unless}}
  <div class="row-fluid">
    <div class="span4">
      <div>
        <div class="pull-left">
          <h4>{{t mirroring.dataset.dataSets}}</h4>
        </div>
        {{#if App.isAdmin}}
          <div class="mirroring-top-nav pull-right btn-group">
            <button {{bindAttr disabled="controller.actionsDisabled"}} class="btn">{{t common.actions}}</button>
            <button {{bindAttr disabled="controller.actionsDisabled"}} class="btn dropdown-toggle" data-toggle="dropdown">
              <span class="caret"></span>
            </button>
            <ul class="dropdown-menu pull-left">
              <li>
                <a href="javascript:void(null);" {{action addNewDataset}}>
                  <i class="icon-plus"></i>&nbsp;{{t mirroring.dataset.createDataset}}
                </a>
              </li>
              <li>
                <a {{action manageClusters}} href="javascript:void(null);">
                  <i class="icon-cog"></i>&nbsp;{{t mirroring.dataset.manageClusters}}...
                </a>
              </li>
            </ul>
          </div>
        {{/if}}
      </div>
      <table class="table advanced-header-table table-bordered dataset-thead">
        <thead>
          {{#view view.sortView contentBinding="view.filteredContent" class="label-row"}}
            <th class="first"></th>
            {{view view.parentView.nameSort}}
            {{view view.parentView.statusSort}}
          {{/view}}
        <tr class="filter-row">
          <th class="first"></th>
          <th>{{view view.nameFilterView}}</th>
          <th>{{view view.statusFilterView}}</th>
        </tr>
        </thead>
      </table>
      <div class="scrollable-table">
        <table class="table">
          <tbody>
          {{#if controller.isDatasetLoadingError}}
            <td class="first"></td>
            <td colspan="2">
              {{t mirroring.dataset.dataset.loading.error}}
            </td>
          {{else}}
            {{#if controller.isLoaded}}
              {{#if view.pageContent}}
                {{#each dataset in view.pageContent}}
                {{#view view.DatasetView contentBinding="dataset"}}
                <td class="first">
                  <span {{bindAttr class="dataset.healthClass dataset.healthIconClass"}}></span>
                </td>
                <td class="name">
                  <a title="{{unbound dataset.name}}" href="javascript:void(null)">{{unbound dataset.name}}</a>
                </td>
                <td><span {{bindAttr class="dataset.isRunning:text-info dataset.isSuspended:text-warning"}}>{{dataset.statusFormatted}}</span></td>
                {{/view}}
                {{/each}}
              {{else}}
                <tr>
                  <td class="first"></td>
                  <td colspan="2">
                    {{t mirroring.table.noDatasets}}
                  </td>
                </tr>
              {{/if}}
            {{else}}
              <tr>
                <td class="first"></td>
                <td colspan="2">
                  <div class="spinner"></div>
                </td>
              </tr>
            {{/if}}
          {{/if}}
          </tbody>
        </table>
      </div>
    </div>
    <div class="span8 jobs-container">
      {{view App.MainDatasetJobsView controllerBinding="App.router.mainDatasetJobsController"}}
    </div>
  </div>
</div>